﻿using System;

namespace ExFlash.Tags
{
    public class ExportAssetsTag : Tag
    {
        private readonly int _swfVersion;

        public UInt16 Count
        {
            get;
            private set;
        }

        public AssetData[] Assets
        {
            get;
            private set;
        }

        public ExportAssetsTag(int len, int version, Int32 offset)
            : base(TagCodes.ExportAssets,len, offset)
        {
            _swfVersion = version;
        }

        public override void SwfDeserialize(BinaryBitReader reader)
        {
            Count = reader.ReadUInt16();

            Assets = new AssetData[Count];

            for (int i = 0; i < Count; i++ )
            {
                Assets[i] = new AssetData(_swfVersion);
                Assets[i].SwfDeserialize(reader);
            }
        }

        public override void SwfSerialize(byte[] arr, ref int offset)
        {
            throw new NotImplementedException();
        }
    }
}
